<?php

if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * Global functions for article...
 * used from article->article article->categorys
 *
 * @version    $Id$
 * @package    TobbiVM-Shop
 * @copyright  Copyright (C) 2012
 * @author     Norbert Gebert
 * @license    GPL3
 */

/**
 * Read the tooltip-text from a given path/file
 *
 * @param string $pagename filename includes the text
 * @param string $pagename declare the subdir for the file
 * @return complete image-tag to include in template
 */
function help($filename, $pagename, $max = FALSE)
{
	$file = 'language/' . LANGUAGE . '/tooltip/' . $pagename . '/' . $filename . '.htm';
	$html = '';
	
	if ((empty($filename) or empty($pagename) or ( empty($filename) and empty($pagename)))
		or !is_file($file))
	{
		$html = ('<img margin-left="20px" src="template/images/help.png" title="' .
			_('No help availiable!') . '">');
	}
	else
	{
		if (!$max)
		{
			$html = ('&nbsp&nbsp<img src="template/images/help.png" title="' .
				file_get_contents($file) . '">');
		}
		elseif ($max and HELPBOX)
		{
			$html = '<div class = "help_box">' .
				file_get_contents($file) .
				'</div>';
		}
	}
	return $html;
}

?>
